package logic_control;

import java.util.Random;
import java.util.Scanner;

public class CaiShuZi {
    public static void main(String[] args) {
        Random random = new Random();
        int x = random.nextInt(100) + 1;
        Scanner scanner = new Scanner(System.in);

        while (true) {
            System.out.println("请输入一个[1,100]的整数: ");
            int i = scanner.nextInt();
            if (i < x) {
                System.out.println("猜小了.");
            } else if (i > x) {
                System.out.println("猜大了.");
            } else {
                System.out.println("猜对了.");
                break;
            }

        }
    }
}